<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="员工" />
<%@ include file="../inc/Title.jsp"%>
<head>
<link rel="stylesheet" type="text/css" href="/css/base.css" />
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function selectSuperior(){
		var url="/base/StafferMainForSelect.ihtm";
		ShowIframe("选择员工",url,800,500,"setSuperior()");
	}
	function setSuperior(){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById("staffer.superiorId").value=arr[0];
			document.getElementById("superiorName").value=arr[1];
		}
	}
	function seleHeadImg(){
		var url="/CutImgForm.ihtm";
		ShowIframe("剪切图片",url,500,500,"seleHeadImgExt()");
	}
	function seleHeadImgExt(){
		if(popRetVal!=null){
			document.getElementById("staffer.headImage").value=popRetVal;
			
			document.getElementById("headImageLink").href=popRetVal;
			document.getElementById("headImageLink").style.display="";
		}
	}
	function changeSex(){
		if(document.getElementsByName("sexRadio")[0].checked){
			document.getElementById("staffer.sex").value="MAN";
		}else{
			document.getElementById("staffer.sex").value="FEMALE";
		}
	}
	function changeEnabled(){
		if(document.getElementsByName("enabledRadio")[0].checked){
			document.getElementById("staffer.enabled").value="Y";
			document.getElementById("leaveDateStr").value="";
		}else{
			document.getElementById("staffer.enabled").value="N";
		}
	}
	function doSave(){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		document.getElementById("continue_flag").value="0";
		frm.submit();
	}
	function doSaveAndContinue(){
		document.getElementById("buttonDiv").style.display="none";
		document.getElementById("waitDiv").style.display="";
		document.getElementById("continue_flag").value="1";
		frm.submit();
	}
	function clearSuperior(){
		document.getElementById("staffer.superiorId").value="0";
		document.getElementById("superiorName").value="";
	}
	function doCancel(){
		parent.ClosePop();
	}
	function showMe(){
		if(checkNavigator()[0]!="msie"){
			document.getElementById("accessory_file").className="";
			document.getElementById("attach_file").className="";
		}
		showFormErrorMsg();
		document.getElementById("staffer.stafferName").focus();
	}
</script>
</head>
<body onLoad="showMe();" class="sheet modal-dialog" style=" padding-top:15px;">
<div class="sheet-main" id="bodyDiv" style="width:860px;">
	<form name="frm" method="post" enctype="multipart/form-data">
	  <div class="sheet-list" style="width:100%">
	    <div class="modal-main search-business">
	    	<div style="width:100%;">
				<c:if test="${id==null || id==''}"><c:set var="pageTopTitle" value="新增员工" /></c:if>
				<c:if test="${id!=null && id!=''}"><c:set var="pageTopTitle" value="编辑员工" /></c:if>
				<c:set var="pageTopMark" value="" />
				<%@ include file="../inc/PageTop.jsp"%> 
				<table border="0" cellspacing="1" cellpadding="1" align="center" class="table-a2">
					<tr>
				      	<th><span class="MustInput">*</span>编号：</th>
				      	<spring:bind path="command.staffer.stafferCode">
				      	<td>
							<c:set var="coseClassStr" value="class='TextBox'" />
				      		<c:if test="${command.codeRule.generateRule!='MANUAL' && command.staffer.id==0}">
				      			<c:set var="codeDisabledStr" value="disabled" />
								<c:set var="coseClassStr" value="class='TextBox readonly'" />
				      		</c:if>
							<input type="text" maxlength="15" onKeyUp="goNextInput('staffer.stafferName');" id="${status.expression}" name="${status.expression}" value="${status.value}" ${codeDisabledStr} ${coseClassStr}>
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',1,'staffer.stafferCode');
					          </script>
				     	</td>
				     	</spring:bind>
				      	<th><span class="MustInput">*</span>姓名：</th>
				     	<spring:bind path="command.staffer.stafferName">
				     	<td>
				     		<input type="text" class="TextBox" maxlength="15" onKeyUp="goNextInput('birthdayStr');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',2,'staffer.stafferName');
					          </script>
				     	</td>
				     	</spring:bind>
				      	<th><span class="MustInput">*</span>性别：</th>
				      	<td>
				      		<input type="radio" name="sexRadio" onClick="changeSex();" <c:if test="${command.staffer.sex=='MAN'}">checked</c:if>>男
							<input type="radio" name="sexRadio" onClick="changeSex();" <c:if test="${command.staffer.sex=='FEMALE'}">checked</c:if>>女
							<spring:bind path="command.staffer.sex">
								<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',3);
						          </script>
							</spring:bind>
				      	</td>
				    </tr>
				    <tr>
				    	<th>生日：</th>
				    	<spring:bind path="command.birthdayStr">
				    	<td>
				    		<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="goNextInput('staffer.origin');" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('birthdayStr'),'yyyy-mm-dd',this);">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',4,'birthdayStr');
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th>籍贯：</th>
				    	<spring:bind path="command.staffer.origin">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="10" onKeyUp="goNextInput('staffer.household');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',5,'staffer.origin');
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th>户口：</th>
				    	<spring:bind path="command.staffer.household">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="10" onKeyUp="goNextInput('staffer.phone');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',6,'staffer.household');
					          </script>
				    	</td>
				    	</spring:bind>
				    </tr>
					<tr>
				    	<th>电话：</th>
				    	<spring:bind path="command.staffer.phone">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="20" onKeyUp="goNextInput('staffer.subPhone');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',7,'staffer.phone');
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th>分机：</th>
				    	<spring:bind path="command.staffer.subPhone">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="10" onKeyUp="goNextInput('staffer.qq');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',8,'staffer.subPhone');
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th>qq：</th>
				    	<spring:bind path="command.staffer.qq">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="15" onKeyUp="goNextInput('staffer.mobile');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',9,'staffer.qq');
					          </script>
				    	</td>
				    	</spring:bind>
				    </tr>
				    <tr>
						<th>手机：</th>
				    	<spring:bind path="command.staffer.mobile">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="20" onKeyUp="goNextInput('staffer.subMobile');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',10,'staffer.mobile');
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th>移动短号：</th>
				    	<spring:bind path="command.staffer.subMobile">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="15" onKeyUp="goNextInput('staffer.email');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',11,'staffer.subMobile');
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th>电子邮件：</th>
				    	<spring:bind path="command.staffer.email">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="50" onKeyUp="goNextInput('staffer.possie');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',12,'staffer.email');
					          </script>
				    	</td>
				    	</spring:bind>
				    </tr>
					<tr>
				    	<th><span class="MustInput">*</span>部门：</th>
				    	<spring:bind path="command.staffer.departmentId">
				    	<td>
				    		<select name="${status.expression}" id="${status.expression}" style="width:152px;">
								<option value="0">==请选择==</option>
				  				<commonTag:createSelectTree list="${departmentList}" emptyOption="0" defaultValue="${status.value}" />
				  			</select>
					        <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',13);
					        </script>
				    	</td>
				    	</spring:bind>
				    	<th>职位：</th>
				    	<spring:bind path="command.staffer.possie">
				    	<td>
				    		<input type="text" class="TextBox" maxlength="15" onKeyUp="goNextInput('inDateStr');" id="${status.expression}" name="${status.expression}" value="${status.value}">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',14,'staffer.possie');
					          </script>
				    	</td>
				    	</spring:bind>
						<th>上级：</th>
				    	<td>
				    		<spring:bind path="command.superiorName">
				    		<input type="text" class="TextBox readonly" style="width:86px" readOnly="true" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<img class="make-a" src="/images/icon_add.gif" style="cursor:pointer;" onClick="selectSuperior();" title="员工只有设置了上级，上级才能在'我的客户'查看到下级的客户，在日历上查看到下级的工作日志">
							<img class="make-a" src="/images/icon_del.gif" style="cursor:pointer;" onClick="clearSuperior();" />
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',15);
					          </script>
				    		</spring:bind>
				    		<spring:bind path="command.staffer.superiorId">
								<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
							</spring:bind>
				    	</td>
				    </tr>
					<tr>
						<th>入职日期：</th>
				    	<spring:bind path="command.inDateStr">
				    	<td>
				    		<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="goNextInput('staffer.mark');" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('inDateStr'),'yyyy-mm-dd',this);">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',16,'inDateStr');
					          </script>
				    	</td>
				    	</spring:bind>
				    	<th>状态：</th>
				    	<td>
				    		<input type="radio" name="enabledRadio" onClick="changeEnabled();" <c:if test="${command.staffer.enabled=='Y'}">checked</c:if>>在职
				    		<input type="radio" name="enabledRadio" onClick="changeEnabled();" <c:if test="${command.staffer.enabled=='N'}">checked</c:if>>离职
							<spring:bind path="command.staffer.enabled">
							<input type="hidden" id="${status.expression}" name="${status.expression}" value="${status.value}">
							</spring:bind>
				    	</td>
						<spring:bind path="command.leaveDateStr">
						<th>离职日期：</th>
				    	<td>
							<input type="text" class="TextBox Datetime" maxlength="15" id="${status.expression}" name="${status.expression}" value="${status.value}">
							<img src="/images/calendar.gif" style="cursor:pointer" onClick="displayCalendar(document.getElementById('leaveDateStr'),'yyyy-mm-dd',document.getElementById('leaveDateStr'));">
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',17,'leaveDateStr');
					          </script>
				    	</td>
						</spring:bind>
					</tr>
					<tr>
				    	<th>简历：</th>
				    	<td>
				    		<input type="file" class="TextBox" style="width:150px" id="accessory_file" name="accessory_file">
							<c:if test="${command.staffer.accessory!=null && command.staffer.accessory!=''}">
								<a href="${command.staffer.accessory}" target="_blank">查看</a>
							</c:if>
							<spring:bind path="command.staffer.accessory">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',18,'accessory_file');
						          </script>
							</spring:bind>
				    	</td>
						<th>身份证图片：</th>			    	
				    	<td>
				    		<input type="file" class="TextBox" style="width:150px" name="attach_file" id="attach_file">
							<c:if test="${command.staffer.image!=null && command.staffer.image!=''}">
								<a href="${command.staffer.image}" target="_blank">查看</a>
							</c:if>
							<spring:bind path="command.staffer.image">
						          <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',19,'attach_file');
						          </script>
					      	</spring:bind>
				    	</td>
				    	<th>个人头像：</th>			    	
				    	<td>
				    		<a href="javascript:seleHeadImg();">选择头像</a>
				    		<a href="${command.staffer.headImage}" id="headImageLink" target="_blank" <c:if test="${command.staffer.headImage==null || command.staffer.headImage==''}">style="display:none"</c:if>>查看</a>
							<spring:bind path="command.staffer.headImage">
								<input type="hidden" name="${status.expression}" id="${status.expression}" value="${status.value}">
						        <script language="javascript">
						          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',19,'head_file');
						    	</script>
					      	</spring:bind>
				    	</td>
				    </tr>
					<tr>
				    	<th>备注：</th>
				    	<spring:bind path="command.staffer.mark">
				    	<td colspan="5">
				    		<textarea class="TextBox" style="width:660px;height:100px" id="${status.expression}" name="${status.expression}">${status.value}</textarea>
					          <script language="javascript">
					          	setFormErrorMsg('<c:out value="${status.errorMessage}" />',18,'staffer.mark');
					          </script>
				    	</td>
				    	</spring:bind>
				    </tr>
				</table>
			</div>
	  	</div>
	  </div>
		<div class="modal-buttom" id="buttonDiv">
			<input type="button" class="buttom-a" value=" 保 存 " onClick="doSave();">
			<input type="button" class="buttom-a" value="保存并新增" onClick="doSaveAndContinue();">
			<input type="button" class="buttom-a" value=" 取 消 " onClick="doCancel();">
			<input type="hidden" name="continue_flag" id="continue_flag" value="0">
		</div>
		<div class="modal-buttom" id="waitDiv" style="display:none">
			<span style="color:#ffffff">请稍候...</span>
		</div>
	</form>
</div>		
</body>
</html>